#imports Pyata library
import sys
sys.path.append("/home/stefan/Documents/fydp/fydp-david/pyata-read-only/pyata/src")
from Pd import *


#mains method
if __name__ == '__main__':
    
    #creates an instance of Pd
    pd = Pd()
    
    #initializes Pyata
    pd.init()

    msg = Message(100, 100, "1")
    comma = Message(100, 100, "addcomma")
    msg2 = Message(100, 100, "0 50")
    line = Object(100,125,"line~")
    osc = Object(100, 150, "osc~")
    vol = Object(100, 175, "*~ 200")
    dac = Object(100, 200, "dac~")

    connect(msg, 0, line, 0)
    connect(line, 0, osc, 0)
    connect(osc, 0, vol, 0)
    connect(vol, 0, dac, 0)
    connect(vol, 0, dac, 1)

    #msg.click()

    osc2 = Object(300, 100, "osc~ 400")
    vol2 = Object(300, 200, "*~ 1")
    dac2 = Object(300, 300, "dac~")        

    connect(osc2, 0, vol2, 0)
    connect(vol2, 0, dac2, 0)
    connect(vol2, 0, dac2, 1)
    
    #edits the osc object from "osc~" to "osc~ 220"
    #osc.edit("osc~ 220")
    
    #sleep(2)
    
    #creates an number in 200, 10 on the patch
    #n1 = Number(osc.x, osc.y-50)
    
    #connects the outlet 0 from osc to the inlet 0 from dac
    #connect(n1, 0, osc, 0)
    
    #sets the value from the number to 440
    #n1.set(440)
    
    #sleep(2)
    
    #increments n1 120 times
    #for i in range(0, 220):
    #    n1.increment()
    #sleep(2)
    
    #prints n1 value
   # print n1.get_value()
    
    #prints all objects available in memory
    #print pd.get_box_list()
    
    #prints all connections available in memory
    #print pd.get_connection_list()
    
    #sleep(2)
    
    
    #finishes Pyata
    #pd.quit()
